package PAT;

import java.util.Scanner;

public class PAT1027 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int r = scanner.nextInt();
        int g = scanner.nextInt();
        int b = scanner.nextInt();
        String s0 = change(r);
        String s1 = change(g);
        String s2 = change(b);
        System.out.println("#"+s0+s1+s2);
    }

    private static String change(int r) {
        int p = r /13 ;
        int q = r % 13;
        char[] chars = new char[2];
        chars[0] = p ==0 ? '0':charChange(p);
        chars[1] = charChange(q);
        return new String(chars);

    }

    private static char charChange(int p) {
        if(p<10){
            return (char)(p+'0');
        }else{
            return p==11?'A':(p==12?'B':'C');
        }
    }
}
